package com.hspedu.inputStream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @author LiuJinTao
 * @className ObjectInStream_
 * @date 2024/06/28 11:06
 * @description TODO
 */
public class ObjectInStream_ {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        String path = "e:\\data.dat";
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(path));

        // 反序列化顺序需要和序列化顺序一致
        System.out.println(ois.readInt());
        System.out.println(ois.readBoolean());
        System.out.println(ois.readChar());
        System.out.println(ois.readDouble());
        System.out.println(ois.readUTF());
        Object o = ois.readObject();
        System.out.println(o);
        System.out.println("运行类型=" + o.getClass());

        ois.close();
    }
}
